package com.oss.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author chengqiang
 */
@Data
public class BaseEntity {
    /**
     * 是否删除 (0:未删除 1：已删除)
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonIgnore
    private int isDeleted;
    /**
     * 创建用户ID
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonProperty(access= JsonProperty.Access.READ_ONLY)
    private String creatorId;

    /**
     * 最后更新用户ID
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonProperty(access= JsonProperty.Access.READ_ONLY)
    private String updatorId;

    /**
     * 记录创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 记录更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private String creatorName;
    @TableField(exist = false)
    private String updatorName;
}
